﻿using System.IO;
using System.ServiceModel;

namespace Ayatta.Contract.Component
{
    /// <summary>
    /// 上传文件信息
    /// </summary>
    [MessageContract]
    public class UploadFile
    {
        /// <summary>
        /// 保存到服务器的文件名
        /// </summary>
        [MessageHeader]
        public string Name { get; set; }

        /// <summary>
        /// 保存到服务器的文件夹
        /// </summary>
        [MessageHeader]
        public string Folder { get; set; }

        /// <summary>
        /// 扩展信息
        /// </summary>
        [MessageHeader]
        public string Extra { get; set; }

        /// <summary>
        /// 待上传的可读文件流
        /// </summary>
        [MessageBodyMember]
        public Stream Data { get; set; }

        public UploadFile()
        {

        }

        public UploadFile(Stream stream, string name, string folder)
        {
            Data = stream;
            Name = name;
            Folder = folder;
        }
    }
}
